home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS04.ADF / image.ed / saveform.h < prev    next >
C/C++ Source or Header  |  1985-10-26  |  3KB  |  59 lines

  1.  
  2. /************* saveformat.h **************/
  3.  
  4. /* this is the format of the data for the Image.Editor, both save and
  5.  * load.... it has some versatility to it in that the size of the 
  6.  * data structure is flexible 
  7.  */
  8.  
  9. struct saveformat {
  10.                 ULONG next;     /* how many BYTES from start is another
  11.                                  * block of data just like this one.
  12.  
  13.                                  * If == 0, then no more blocks follow */
  14.                 ULONG colorset; /* How many BYTES from start of struct is
  15.                                  * table containing the colors used for
  16.                                  * the image editing?
  17.                                  */
  18.                 ULONG dataset;  /* How many BYTES from start of struct is
  19.                                  * table containing the planes of data?
  20.                                  */
  21.                 ULONG depth;    /* Defines how many colors (power-of-two)
  22.                                  * are in the color table, (if depth = 2,
  23.                                  * there are 4 colors, 3->8, 4->16, 5->32
  24.                                  * as well as how many planes of data per 
  25.                                  * image.
  26.                                  */
  27.                 ULONG width;    /* bitwidth of the image   */
  28.                 ULONG height;   /* lineheight of the image */
  29.                 UWORD datastart;/* data starts here        */
  30.                 };
  31.  
  32.         
  33. /* Format can be used to save color only, data only, or color and data.
  34.  * Convention used:  If saveformat.colorset == 0, then no colors stored.
  35.  *                   If saveformat.dataset == 0, then no data stored.
  36.  *                   If both nonzero, and if this file read into a 
  37.  *                      large contiguous buffer, you find tables
  38.  *                      by the technique:
  39.  *
  40.  *                              struct saveformat *s;
  41.  *                              UWORD buffer[1000];
  42.  *                              UWORD *b;
  43.  *                              UWORD *colordata;
  44.  *                              UWORD *imagedata;
  45.  *
  46.  *                              b = &buffer[0]; 
  47.  *                              s = b;
  48.  *                              if(s->colorset != 0)
  49.  *                                      colordata = b + s->colorset;
  50.  *                              else
  51.  *                                      colordata = NULL;
  52.  *                              if(s->dataset != 0)
  53.  *                                      imagedata = b + s->dataset;
  54.  *                              else
  55.  *                                      imagedata = NULL;
  56.  *
  57.  *
  58.  *********** Rob Peck  6/20/85 ***************************************** */
  59.